<?php
// 创建短链接页面
// Include All Header Files 
require ("./includes/pears.php");
// ui related 
require ("./includes/config.php");

// 输入的参数
if (!empty($_REQUEST['url']))
{

    $realurl = trim ($_REQUEST['url']);
}
else
{
    die("");
}
$has_token = false;
if (!empty($realurl))
{
    $result = Facade::genToken($realurl);
}

$result_code  = $result['code'];
$result_token = $result['token'];
$cururl       = "http://" .DUANURL_HOSTNAME . "/". $result_token;
$pcururl      = "http://" .DUANURL_PREVIEW_HOSTNAME . "/". $result_token;
$html_realurl = htmlspecialchars($realurl);
$html_token   = htmlspecialchars($result_token);
$html_cururl  = htmlspecialchars($cururl);
$html_pcururl  = htmlspecialchars($pcururl);
$cururl_len   = strlen($cururl);
$realurl_len  = strlen($realurl);
// header 变为text/plian
//输出url
echo $cururl;
?>
